#ifndef __ANALYSER_H__
#define __ANALYSER_H__

#include "WorldModelNode.h"
#include "../Render/RenderNode.h"
#include <cmath>
#include <string>
#include <vector>

enum SearchTeamSide
{
	Team_Left,
	Team_Right,
	Team_NotSpecified
};

struct SearchSLT
{
	float slt[16];
};

typedef float		SearchTime;
typedef std::string SearchName;
typedef SearchSLT   ObjPosSLT;

struct AgentInfo
{
	std::string name;
	float *pos;
};

class Analyser
{
public:
	Analyser();
	~Analyser();

	void SetSearchTime( SearchTime time );
	void SetSearchTimeInterval( SearchTime bTime, SearchTime eTime );
	void SetSearchTeamSide( SearchTeamSide isSearchLeft );
	void SetSearchObjName( const std::string& name );

	bool SearchInfo( WorldModelNode* wmNode );
	bool SearchInfo( WorldModelNode* wmNode, float* pos );
	bool SearchInfo( WorldModelNode* wmNode, std::vector< ObjPosSLT >& posVec );
	bool SearchInfo( std::vector<WorldModelNode*> &wmNodeVec );

	bool AnalyseAgentInfo( WorldModelNode* wmNode, std::vector<AgentInfo>& agentInfoVec );

private:
	SearchTime					m_sTimeBegin;
	SearchTime					m_sTimeEnd;
	SearchTeamSide				m_sTeamSide;
	SearchName					m_sObjName;
	std::vector<SearchSLT>		m_sSLTVec;
	std::vector<SearchName>		m_sSearchedName;
	std::vector<SearchTime>		m_sSearchedTime;

	std::vector<RenderNode*>	m_AgentNodeVec;

	bool TimeOk( WorldModelNode* wmNode );
	void GetObjName( WorldModelNode* wmNode );
	void GetObjName( RenderNode* rn, const std::string& name );
	void GetAgentNode( RenderNode* rn );
	RenderNode* GetAgentBodyNode( RenderNode* rn );
	std::string GetAgentNum( RenderNode* rn );
	std::string GetAgentNumSide( const std::string& num, const std::string& side );

	void PrintSearchedSLT();
	bool FindName( const std::string& src_str, const std::string& trg_str );
};

#endif //__ANALYSER_H__